package history.study.dynamic_programming;

// 343. 整数拆分
public class LeetCode_343 {
    public int integerBreak(int n) {
        int []state = new int[n+1];
        state[1] = 1;
        state[2] = 1;
        for (int i = 3; i <= n; i++) {
            for (int j = 1; j < i-1; j++) {
                state[i] = Math.max(state[i], Math.max((i-j)*j, state[i-j]*j));
            }
        }
        return state[n];
    }
}
